import java.util.Arrays;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Lenovo
 * Date: 2025-08-12
 * Time: 20:03
 */
//https://leetcode.cn/problems/move-zeroes/submissions/
public class Test {
    public static void moveZeroes(int[] nums) {
        for(int p1=0,p2=0;p2<nums.length;p2++){
            if(nums[p2]!=0){
                int n=nums[p1];
                nums[p1]=nums[p2];
                nums[p2]=n;
                p1++;
            }
        }
    }

    public static void main(String[] args) {
        int[] arr={0,1,0,3,12};
        moveZeroes(arr);
        System.out.println(Arrays.toString(arr));
    }
}
